package day14;

import java.util.ArrayList;
import java.util.List;

public class TestGeneric2 {
	public static void main(String[] args) {
		ArrayList<Number> a1 = new ArrayList<Number>();
		ArrayList<Integer> a2 = new ArrayList<Integer>();
		ArrayList<Double> a3 = new ArrayList<Double>();
		ArrayList<String> a4 = new ArrayList<String>();
		ArrayList<Object> a5 = new ArrayList<Object>();
		print(a1);
		print(a2);
		print(a3);
		print(a4);//List<Object> list = new ArrayList<String>();
		print(a5);//List<Object> list = new ArrayList<Object>();
		//List<?> l = new ArrayList<Number>();
	}
	public static void print(List<? extends Number> list){
		//list.add(1.2);
		for(Object o : list){
			System.out.println(o);
			//Number n = (Number) o;
		}
	}
	/*public static void print(List<? super Number> list){
		//list.add(1.2);
		list.add(10);
		//list.add(new Object());
		for(Object o : list){
			System.out.println(o);
			//Number n = (Number) o;
		}
	}*/
}


